package com.caipin.controller;

/**
 * @Author: zhunian0322@163.com
 * @DateTime: 2021-09-30 9:24
 * @Description: TODO
 */
@RestController
@RequestMapping({"/faceDatabaseManagement"})
public class FaceDatabaseManagementController {
    @Autowired
    private FaceDatabaseManagementService faceDatabaseManagementService;

    @GetMapping({"/faceDatabaseList"})
    public Object getFaceDatabaseList(@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize, @RequestParam(value = "personId", required = false) String personId, @RequestParam(value = "personType", required = false) String personType, @RequestParam(value = "personName", required = false) String personName) {
        PageBean<FaceImageData> pageBean = null;
        pageBean = this.faceDatabaseManagementService.findFaceDataBaseLike(pageNum, pageSize, personId, personType, personName);
        return ResultJson.ok(pageBean);
    }

    @DeleteMapping({"/faceDatabase/{id}"})
    public Object delFaceDatabaseById(@PathVariable("id") Long id) {
        this.faceDatabaseManagementService.delFaceDatabaseById(id);
        return ResultJson.ok();
    }

    @DeleteMapping({"/faceDatabaseList"})
    public Object delFaceDatabaseList(@RequestBody List<Long> ids) {
        int count = this.faceDatabaseManagementService.delFaceDatabaseListByIds(ids);
        Map<String, Integer> map = new HashMap<>();
        map.put("count", Integer.valueOf(count));
        return ResultJson.ok(map);
    }
}

